/**导入类转换字段的方法 */
import {
    hospitalMD,
    venueMD,
    venueMedicalPointMD,
    venueDetailMD,
    ambulanceMD,
    taskStatusMD,
    inteligentSchedulMD,
    patientListMD,
    tableDataMD,
    treeFormatDataMD,
    PatientDataMD,
    // 病例实体
    diagnosisMD,
    bodyCheckMD,
    CTTZMD,
    dispositionMD,
    illHistoryMD,
    auxiliaryExamMD,
    whereaboutsMD,
    scheduleListMD
}
    from "./modelIndex"
import {
    wgs84togcj02tobd09
} from "utils/84tobaiduGPS.js"
/**
 * 
 * @param {医院列表} objJson 
 * @returns 返回转换字段后请求的医院数据
 */
export function hospitalList(objJson) {
    let hospitalArr = []
    objJson.forEach(element => {
        const hospitalMDItem = new hospitalMD()
        hospitalMDItem.id = element.Code
        hospitalMDItem.name = element.ChineseName
        hospitalMDItem.address = element.Address
        hospitalMDItem.lng = element.Lng
        hospitalMDItem.lat = element.Lat
        // console.log(hospitalMDItem.lng,hospitalMDItem.lat)
        let baidugps = wgs84togcj02tobd09(element.Lng, element.Lat)
        hospitalMDItem.lng = baidugps.Lng
        hospitalMDItem.lat = baidugps.Lat
        // console.log(hospitalMDItem.lng,hospitalMDItem.lat)
        hospitalMDItem.activityCode = element.ActivityCode
        hospitalMDItem.cityCode = element.CityCode
        hospitalMDItem.contactName1 = element.ContactsName1
        hospitalMDItem.contactName2 = element.ContactsName2
        hospitalMDItem.tel1 = element.Telephone1
        hospitalMDItem.tel2 = element.Telephone2
        hospitalMDItem.chineseName = element.ChineseName
        hospitalMDItem.englishName = element.EnglishName
        hospitalArr.push(hospitalMDItem)
    });
    // console.log(hospitalArr)
    return hospitalArr;
}
/**
 * 
 * @param {场馆} objJson 
 * @returns 返回转换字段后请求的场馆数据
 */
export function venueList(objJson) {
    // console.log(objJson)
    let venueArr = []
    objJson.forEach(element => {
        const venueMDItem = new venueMD()
        venueMDItem.id = element.Code
        venueMDItem.activityCode = element.ActivityCode
        venueMDItem.cityCode = element.CityCode
        venueMDItem.name = element.CHIDescription
        venueMDItem.CHIDescription = element.CHIDescription
        venueMDItem.startTime = element.StartTime
        venueMDItem.endTime = element.EndTime
        venueMDItem.lng = element.Lng
        venueMDItem.lat = element.Lat
        let baidugps = wgs84togcj02tobd09(element.Lng, element.Lat)
        venueMDItem.lng = baidugps.Lng
        venueMDItem.lat = baidugps.Lat
        venueMDItem.zoomLevel = element.ZoomLevel
        venueMDItem.type = element.Type
        venueMDItem.ENGDescription = element.ENGDescription
        venueMDItem.ENGLongDescription = element.ENGLongDescription
        venueMDItem.CHILongDescription = element.CHILongDescription
        venueMDItem.TVName = element.TVName
        venueMDItem.indoorOutdoor = element.IndoorOutdoor
        venueMDItem.cluster = element.Cluster
        venueMDItem.project = element.Project
        venueMDItem.address = element.Address
        //场馆内的医疗点
        if (element.Children) {
            if (element.Children.length > 0) {
                element.Children.forEach(eleChildItem => {
                    let venueMedicalPointitem = new venueMedicalPointMD()
                    venueMedicalPointitem.id = eleChildItem.Code
                    venueMedicalPointitem.name = eleChildItem.Name
                    venueMedicalPointitem.lng = eleChildItem.Lng
                    venueMedicalPointitem.lat = eleChildItem.Lat
                    let baidugps = wgs84togcj02tobd09(Number(venueMedicalPointitem.lng), Number(venueMedicalPointitem.lat))
                    venueMedicalPointitem.lng = baidugps.Lng
                    venueMedicalPointitem.lat = baidugps.Lat
                    venueMedicalPointitem.type = eleChildItem.Type
                    venueMedicalPointitem.doctor = eleChildItem.Doctor
                    venueMedicalPointitem.nurse = eleChildItem.Nurse
                    venueMedicalPointitem.online = eleChildItem.OnLine
                    venueMDItem.children.push(venueMedicalPointitem)
                })
            }
        }
        venueArr.push(venueMDItem)
    });
    // console.log(venueArr)
    return venueArr;
}

/**
 * 
 * @param {场馆} objJson 
 * @returns 返回转换字段后请求的场馆数据
 */
export function venueDetailMsg(objJson) {
    // console.log("returnModel", objJson)
    let venueDetailArr = []
    const venueDetailMDItem = new venueDetailMD()
    for (let element of objJson) {
        if (element.matchStart == true) {
            venueDetailMDItem.address = element.address
            venueDetailMDItem.ambulanceNumber = element.ambulanceNumber
            venueDetailMDItem.matchName = element.matchName
            venueDetailMDItem.matchStart = element.matchStart
            venueDetailMDItem.matchStartName = element.matchStartName
            venueDetailMDItem.matchStartTime = element.matchStartTime
            venueDetailMDItem.matchEndTime = element.matchEndTime
            venueDetailMDItem.medicalPointNumber = element.medicalPointNumber
            venueDetailMDItem.name = element.name
            // console.log("内",venueDetailArr)
            break;
        } else { //为false
            venueDetailMDItem.address = element.address
            venueDetailMDItem.ambulanceNumber = element.ambulanceNumber
            venueDetailMDItem.matchName = "暂无赛事"
            venueDetailMDItem.matchStart = element.matchStart
            venueDetailMDItem.matchStartName = "赛事未开始"
            venueDetailMDItem.matchStartTime = "暂无开始时间"
            venueDetailMDItem.matchEndTime = "暂无结束时间"
            venueDetailMDItem.medicalPointNumber = element.medicalPointNumber
            venueDetailMDItem.name = element.name
        }
    }
    // objJson.forEach(element => {

    // });
    venueDetailArr.push(venueDetailMDItem)
    // console.log("外", venueDetailArr)
    return venueDetailArr;
}
/**
 * 
 * @param {车辆} objJson 
 * @returns 返回转换字段后请求的车辆数据
 */
export function ambulanceList(objJson) {
    // console.log(objJson)
    let ambulanceGroupArr = []
    objJson.forEach(element => {
        const ambulanceGroup = new ambulanceMD()
        const ambulanceChildItem = new (ambulanceGroup.childrenMD)()
        ambulanceChildItem.id = element.Code
        ambulanceChildItem.name = element.Name
        ambulanceChildItem.lng = element.Lng
        ambulanceChildItem.lat = element.Lat
        // console.log(ambulanceChildItem.lng,ambulanceChildItem.lat)
        let baidugps = wgs84togcj02tobd09(element.Lng, element.Lat)
        ambulanceChildItem.lng = baidugps.Lng
        ambulanceChildItem.lat = baidugps.Lat
        // console.log(ambulanceChildItem.lng,ambulanceChildItem.lat)
        ambulanceChildItem.activityCode = element.ActivityCode
        ambulanceChildItem.activityVenuesCode = element.ActivityVenuesCode
        ambulanceChildItem.cityCode = element.CityCode
        ambulanceChildItem.doctor = element.Doctor
        ambulanceChildItem.driver = element.Driver
        ambulanceChildItem.eventCode = element.EventCode
        ambulanceChildItem.isOnline = element.IsOnline
        if (element.IsOnline == true) {
            ambulanceChildItem.isOnline = "在线"
        } else {
            ambulanceChildItem.isOnline = "离线"
        }
        ambulanceChildItem.nurse = element.Nurse
        ambulanceChildItem.stateCode = element.StateCode
        ambulanceChildItem.stateName = element.StateName
        ambulanceChildItem.stretcher = element.Stretcher
        ambulanceChildItem.telephone = element.Telephone
        ambulanceChildItem.direction = element.Direction
        ambulanceChildItem.isEffective = element.IsEffective
        if (element.IsEffective == true) {
            ambulanceChildItem.isEffective = "有效"
        } else {
            ambulanceChildItem.isEffective = "无效"
        }
        ambulanceGroupArr.push(ambulanceChildItem)
    });
    // console.log(ambulanceGroupArr)
    return ambulanceGroupArr;
}

/**
 * 
 * @param {任务} objJson 
 */
export function taskStatusList(objJson) {
    if (objJson != null) {
        const taskStatusArr = []
        objJson.forEach(item => {
            const taskStatus = new taskStatusMD()
            taskStatus.id = item.id
            taskStatus.patient = item.patient
            taskStatus.updateTime = item.updateTime
            taskStatus.status = item.status
            taskStatusArr.push(taskStatus)
        })
        //  console.log(taskStatusArr)
        return taskStatusArr
    }
}

/**
 * 
 * @param {智能调度} objJson 
 */
export function inteligentSchedulList(objJson) {
    // console.log(objJson)
    const inteligentSchedulArr = []
    if (objJson != null) {
        objJson.forEach(item => {
            const inteligentSchedul = new inteligentSchedulMD()
            inteligentSchedul.id = item.id
            inteligentSchedul.illnessState = item.illnessState
            inteligentSchedul.tag = item.tag
            inteligentSchedul.ambulance = item.ambulance
            inteligentSchedul.hospital = item.hospital
            inteligentSchedul.ambulanceLng = item.ambulanceLng
            inteligentSchedul.ambulanceLat = item.ambulanceLat
            inteligentSchedul.hospitalLng = item.hospitalLng
            inteligentSchedul.hospitalLat = item.hospitalLat
            inteligentSchedulArr.push(inteligentSchedul)
        })
        //  console.log(taskStatusArr)
        return inteligentSchedulArr
    }
}

/**
 * 
 * @param {病人列表} objJson 
 */
export function patientList(objJson) {
    const patientArr = []
    if (objJson != null) {
        objJson.forEach(item => {
            const patient = new patientListMD()
            patient.id = item.id
            patient.illnessState = item.illnessState
            patient.patientName = item.patientName
            patient.group = item.group
            patient.time = item.time
            patient.status = item.status
            patient.tag = item.tag
            patient.sendHospital = item.sendHospital
            patient.sceneAddress = item.sceneAddress
            patient.diagnosis = item.diagnosis
            patient.ambulance = item.ambulance
            patientArr.push(patient)
        })
        //  console.log(taskStatusArr)
        return patientArr
    }
}
/**
 * 药品耗材树格式化
 * @param {*} objJson 
 * @returns 
 */
export function treeFormatData(objJson) {
    // console.log(objJson)
    let treeFormatArr = []
    objJson.forEach(ele => {
        let treeFormat = new treeFormatDataMD()
        treeFormat.id = ele.MedicalPoint_Code
        treeFormat.name = ele.MedicalPoint_Name
        treeFormatArr.push(treeFormat)
    })
    return treeFormatArr
}
/**
 * 诊断
 * @param {*} objJson 
 * @returns 
 */
export function diagnosisMDRetu(objJson) {
    // console.log(objJson)
    let diagnosisArr = []
    if (objJson.length > 0) {
        objJson.forEach(item => {
            let diagnosisMDitem = new diagnosisMD()
            // diagnosisMDitem.patientRecordCode = item.PatientRecordCode
            diagnosisMDitem.order = item.Order
            diagnosisMDitem.specialTag = item.SpecialTag
            diagnosisMDitem.hurtPart = item.InjuredPart
            diagnosisMDitem.diangoTime = item.DateTime
            diagnosisMDitem.preCheckLevel = item.Classification
            diagnosisMDitem.parentDiagnosis = item.ParentDiagnosis
            diagnosisMDitem.childrenDiagnosis = item.ChildrenDiagnosis
            // diagnosisMDitem.illtype = item.Classify
            // diagnosisMDitem.mainSymptoms = item.CardinalSymptom
            // diagnosisMDitem.level = item.Level
            // diagnosisMDitem.fillingPersonne = item.FillingPersonne
            // diagnosisMDitem.date = item.Date
            diagnosisArr.push(diagnosisMDitem)
        })
        // console.log(diagnosisArr)
        return diagnosisArr
    } else {
        return diagnosisArr
    }
}

/**
 * 查体()YBCTs
 * @param {*} objJson 
 * @returns 
 */
export function bodyCheckMDRetu(objJson) {
    // console.log(objJson)
    let bodyCheckArr = []
    if (objJson.length > 0) {
        objJson.forEach(item => {
            let bodyCheckMDitem = new bodyCheckMD()
            // bodyCheckMDitem.patientRecordCode = item.PatientRecordCode
            bodyCheckMDitem.order = item.Order
            bodyCheckMDitem.leftPupil = item.LeftPupil
            bodyCheckMDitem.leftPupilSupplement = item.LeftPupilSupplement
            bodyCheckMDitem.rightPupil = item.RightPupil
            bodyCheckMDitem.rightPupilSupplement = item.RightPupilSupplement
            bodyCheckMDitem.head = item.Cephalosome
            bodyCheckMDitem.cephalosomeSupplement = item.CephalosomeSupplement
            bodyCheckMDitem.neck = item.Neck
            bodyCheckMDitem.neckSupplement = item.NeckSupplement
            bodyCheckMDitem.chest = item.Chest
            bodyCheckMDitem.chestSupplement = item.ChestSupplement
            bodyCheckMDitem.lung = item.Lung
            bodyCheckMDitem.lungSupplement = item.LungSupplement
            bodyCheckMDitem.heart = item.Heart
            bodyCheckMDitem.heartSupplement = item.HeartSupplement
            bodyCheckMDitem.abdomen = item.Abdomen
            bodyCheckMDitem.abdomenSupplement = item.AbdomenSupplement
            bodyCheckMDitem.pelvis = item.Pelvis
            bodyCheckMDitem.pelvisSupplement = item.PelvisSupplement
            bodyCheckMDitem.armlegs = item.ArmsAndLegs
            bodyCheckMDitem.armsAndLegsSupplement = item.ArmsAndLegsSupplement
            bodyCheckMDitem.backbone = item.Spine
            bodyCheckMDitem.spineSupplement = item.SpineSupplement
            bodyCheckMDitem.neurologicSigns = item.Neuro
            bodyCheckMDitem.neuroSupplement = item.NeuroSupplement
            bodyCheckMDitem.others = item.Rests
            // bodyCheckMDitem.leftDGFY = item.LeftDGFY
            // bodyCheckMDitem.fillingPersonne = item.FillingPersonne
            // bodyCheckMDitem.date = item.Date
            // bodyCheckMDitem.rightDGFY = item.RightDGFY
            // bodyCheckMDitem.personneName = item.PersonneName
            bodyCheckArr.push(bodyCheckMDitem)
        })
        // console.log(bodyCheckArr)
        return bodyCheckArr
    } else {
        return bodyCheckArr
    }
}


/**
 * 查体体征()SMTZ生命体征
 * @param {*} objJson 
 * @returns 
 */
export function CTTZMDRetu(objJson) {
    // console.log(objJson)
    let CTTZArr = []
    if (objJson.length > 0) {
        objJson.forEach(item => {
            let CTTZMDitem = new CTTZMD()

            // CTTZMDitem.patientRecordCode = item.PatientRecordCode
            CTTZMDitem.order = item.Order
            CTTZMDitem.T = item.T
            CTTZMDitem.P = item.P
            CTTZMDitem.R = item.R
            CTTZMDitem.SBP = item.SBP
            CTTZMDitem.SPO2 = item.SPO2
            CTTZMDitem.consciousness = item.Consciousness
            CTTZMDitem.score = item.Score
            // CTTZMDitem.OBP = item.OBP
            // CTTZMDitem.date = item.Date
            // CTTZMDitem.fillingPersonne = item.FillingPersonne
            // CTTZMDitem.personneName = item.PersonneName
            // CTTZMDitem.explain = item.Explain
            CTTZArr.push(CTTZMDitem)
        })
        // console.log(CTTZArr)
        return CTTZArr
    } else {
        return CTTZArr
    }
}

/**
 * 处置
 * @param {*} objJson 
 * @returns 
 */
export function dispositionMDRetu(objJson) {
    // console.log(objJson)
    let dispositionArr = []
    if (objJson.length > 0) {
        objJson.forEach(item => {
            let dispositionMDitem = new dispositionMD()

            // dispositionMDitem.patientRecordCode = item.PatientRecordCode
            dispositionMDitem.order = item.Order
            dispositionMDitem.check = item.Examine
            dispositionMDitem.illTell = item.Inform
            dispositionMDitem.circulatorySupport = item.CirculatorySupport
            dispositionMDitem.airwayManagement = item.AirwayManagement
            dispositionMDitem.bindFixed = item.BindUp
            dispositionMDitem.drugCure = item.DrugTherapy
            // dispositionMDitem.others = item.Rests
            // dispositionMDitem.fillingPersonne = item.FillingPersonne
            // dispositionMDitem.JJZLPicture = item.JJZLPicture
            // dispositionMDitem.date = item.Date
            // dispositionMDitem.personneName = item.PersonneName
            dispositionArr.push(dispositionMDitem)
        })
        // console.log(dispositionArr)
        return dispositionArr
    } else {
        return dispositionArr
    }
}


/**
 * 病史
 * @param {*} objJson 
 * @returns 
 */
export function illHistoryMDRetu(objJson) {
    // console.log(objJson)
    let illHistoryArr = []
    if (objJson.length > 0) {
        objJson.forEach(item => {
            let illHistoryMDitem = new illHistoryMD()

            // illHistoryMDitem.patientRecordCode = item.PatientRecordCode
            illHistoryMDitem.order = item.Order
            illHistoryMDitem.mainSuit = item.MainSuit
            illHistoryMDitem.curillhistory = item.MedicalHistory
            illHistoryMDitem.previousHistory = item.FormerlyMedicalHistory
            illHistoryMDitem.useDrugHistory = item.PharmacyHistory
            illHistoryMDitem.irritabilityHistory = item.AllergyHistory
            // illHistoryMDitem.lastEatTime = item.FinallyFeedTime
            // illHistoryMDitem.eatFoot = item.FoodThat
            // illHistoryMDitem.fillingPersonne = item.FillingPersonne
            // illHistoryMDitem.date = item.Date
            // illHistoryMDitem.personneName = item.PersonneName
            illHistoryMDitem.sojournHistory = item.SojournHistorySupplement
            illHistoryArr.push(illHistoryMDitem)
        })
        // console.log(illHistoryArr)
        return illHistoryArr
    } else {
        return illHistoryArr
    }
}



/**
 * 辅助检查
 * @param {*} objJson 
 * @returns 
 */
export function auxiliaryExamMDRetu(objJson) {
    // console.log(objJson)
    let auxiliaryExamArr = []
    if (objJson.length > 0) {
        objJson.forEach(item => {
            let auxiliaryExamMDitem = new auxiliaryExamMD()
            // auxiliaryExamMDitem.patientRecordCode = item.PatientRecordCode
            auxiliaryExamMDitem.order = item.Order
            auxiliaryExamMDitem.bloodGlucose = item.BloodGlucose
            auxiliaryExamMDitem.ECG = item.ECG
            auxiliaryExamMDitem.XDTPicture = item.XDTPicture
            auxiliaryExamMDitem.XDJH = item.XDJH
            auxiliaryExamMDitem.XDJHPicture = item.XDJHPicture
            auxiliaryExamMDitem.ECGSupplement = item.ECGSupplement
            // auxiliaryExamMDitem.fillingPersonne = item.FillingPersonne
            // auxiliaryExamMDitem.date = item.Date
            // auxiliaryExamMDitem.personneName = item.PersonneName
            auxiliaryExamArr.push(auxiliaryExamMDitem)
        })
        // console.log(auxiliaryExamArr)
        return auxiliaryExamArr
    } else {
        return auxiliaryExamArr
    }
}


/**
 * 去向
 * @param {*} objJson 
 * @returns 
 */
export function whereaboutsMDRetu(objJson) {
    // console.log(objJson)
    let whereaboutsArr = []
    if (objJson.length > 0) {
        objJson.forEach(item => {
            let whereaboutsMDitem = new whereaboutsMD()
            // whereaboutsMDitem.patientRecordCode = item.PatientRecordCode
            whereaboutsMDitem.order = item.Order
            whereaboutsMDitem.startTime = item.StartTime
            whereaboutsMDitem.endTime = item.EndTime
            whereaboutsMDitem.doctor = item.Doctor
            whereaboutsMDitem.QX = item.QX
            // whereaboutsMDitem.address = item.Address
            // whereaboutsMDitem.nurse = item.Nurse
            // whereaboutsMDitem.grade = item.ECGSupplement
            // whereaboutsMDitem.BQZG = item.BQZG
            // whereaboutsMDitem.fillingPersonne = item.FillingPersonne
            // whereaboutsMDitem.date = item.Date
            // whereaboutsMDitem.addressCode = item.AddressCode
            // whereaboutsMDitem.personneName = item.PersonneName
            whereaboutsArr.push(whereaboutsMDitem)
        })
        // console.log(whereaboutsArr)
        return whereaboutsArr
    } else {
        return whereaboutsArr
    }
}



// 病历TABLE数据格式化
export function formatTableData(obj, index) {
    const tableItem = new tableDataMD()
    tableItem.val = obj[Object.keys(obj)[index]]
    switch (Object.keys(obj)[index]) {
        case "fillingPersonne":
            tableItem.checkItem = "填写人员工号"
            break
        case "date":
            tableItem.checkItem = "填写日期"
            break
        case "order":
            tableItem.checkItem = "序号"
            break
        case "patientRecordCode":
            tableItem.checkItem = "病例编码"
            break
        case "personneName":
            tableItem.checkItem = "填写人员姓名"
            break
        case "others":
            tableItem.checkItem = "其他"
            break
        // 诊断
        case "specialTag":
            tableItem.checkItem = "特殊标签"
            break
        case "hurtPart":
            tableItem.checkItem = "受伤部位"
            break
        case "diangoTime":
            tableItem.checkItem = "诊断时间"
            break
        case "preCheckLevel":
            tableItem.checkItem = "预检分级"
            break
        case "parentDiagnosis":
            tableItem.checkItem = "诊断大类"
            break
        case "childrenDiagnosis":
            tableItem.checkItem = "诊断子级"
            break
        // case "illtype":
        //     tableItem.checkItem = "疾病分类"
        //     break
        // case "mainSymptoms":
        //     tableItem.checkItem = "主要症状"
        //     break
        // case "level":
        //     tableItem.checkItem = "病历等级"
        //     break
        // 一般查体
        case "leftPupil":
            tableItem.checkItem = "左瞳孔"
            break
        case "leftPupilSupplement":
            tableItem.checkItem = "左瞳孔补充"
            break
        case "rightPupil":
            tableItem.checkItem = "右瞳孔"
            break
        case "rightPupilSupplement":
            tableItem.checkItem = "右瞳孔补充"
            break
        // case "leftDGFY":
        //     tableItem.checkItem = "对光反应左"
        //     break
        // case "rightDGFY":
        //     tableItem.checkItem = "对光反应右"
        //     break
        case "head":
            tableItem.checkItem = "头"
            break
        case "cephalosomeSupplement":
            tableItem.checkItem = "头部补充"
            break
        case "neck":
            tableItem.checkItem = "颈"
            break
        case "neckSupplement":
            tableItem.checkItem = "颈部补充"
            break
        case "chest":
            tableItem.checkItem = "胸部"
            break
        case "chestSupplement":
            tableItem.checkItem = "胸部补充"
            break
        case "lung":
            tableItem.checkItem = "肺部"
            break
        case "lungSupplement":
            tableItem.checkItem = "肺部补充"
            break
        case "heart":
            tableItem.checkItem = "心"
            break
        case "heartSupplement":
            tableItem.checkItem = "心脏补充"
            break
        case "abdomen":
            tableItem.checkItem = "腹部"
            break
        case "abdomenSupplement":
            tableItem.checkItem = "腹部补充"
            break
        case "pelvis":
            tableItem.checkItem = "骨盆"
            break
        case "pelvisSupplement":
            tableItem.checkItem = "骨盆补充"
            break
        case "backbone":
            tableItem.checkItem = "脊柱"
            break
        case "spineSupplement":
            tableItem.checkItem = "脊柱补充"
            break
        case "armlegs":
            tableItem.checkItem = "四肢"
            break
        case "armsAndLegsSupplement":
            tableItem.checkItem = "四肢补充"
            break
        case "neurologicSigns":
            tableItem.checkItem = "神经系统"
            break
        case "neuroSupplement":
            tableItem.checkItem = "神经系统补充"
            break
        // 查体体征
        case "T":
            tableItem.checkItem = "T"
            break
        case "P":
            tableItem.checkItem = "P"
            break
        case "R":
            tableItem.checkItem = "R"
            break
        case "SBP":
            tableItem.checkItem = "SBP"
            break
        case "SPO2":
            tableItem.checkItem = "SPO2"
            break
        // case "OBP":
        //     tableItem.checkItem = "舒张压"
        //     break
        case "consciousness":
            tableItem.checkItem = "神志"
            break
        case "score":
            tableItem.checkItem = "得分"
            break
        // case "explain":
        //     tableItem.checkItem = "得分说明"
        //     break
        // 处置
        case "check":
            tableItem.checkItem = "辅助检查"
            break
        case "illTell":
            tableItem.checkItem = "病情告知"
            break
        case "circulatorySupport":
            tableItem.checkItem = "循环支持"
            break
        case "airwayManagement":
            tableItem.checkItem = "呼吸支持"
            break
        case "bindFixed":
            tableItem.checkItem = "包扎固定"
            break
        case "drugCure":
            tableItem.checkItem = "药物治疗"
            break
        case "JJZLPicture":
            tableItem.checkItem = "拒绝治疗签字"
            tableItem.isPicFlag = "JJZL"
            tableItem.JJZLPicture = obj["JJZLPicture"] != null ? obj["JJZLPicture"] : "";
            break
        // 病史
        case "mainSuit":
            tableItem.checkItem = "主诉"
            break
        case "curillhistory":
            tableItem.checkItem = "现病史"
            break
        case "useDrugHistory":
            tableItem.checkItem = "用药史"
            break
        case "previousHistory":
            tableItem.checkItem = "既往史"
            break
        case "irritabilityHistory":
            tableItem.checkItem = "过敏史"
            break
        case "lastEatTime":
            tableItem.checkItem = "最后进食时间"
            break
        case "eatFoot":
            tableItem.checkItem = "食物内容"
            break
        case "sojournHistory":
            tableItem.checkItem = "流行病学接触史或疫区旅居史"
            break

        // 辅助检查
        case "bloodGlucose":
            tableItem.checkItem = "血糖"
            break
        case "ECG":
            tableItem.checkItem = "心电图"
            tableItem.isPicFlag = "XDT"
            tableItem.XDTPicture = obj["XDTPicture"]
            break
        case "XDJH":
            tableItem.checkItem = "心电监护"
            tableItem.isPicFlag = "XDJH"
            tableItem.XDJHPicture = obj["XDJHPicture"]
            break
        case "ECGSupplement":
            tableItem.checkItem = "心电图补充"
            break
        // 去向
        case "startTime":
            tableItem.checkItem = "就诊时间"
            break
        case "endTime":
            tableItem.checkItem = "离开时间"
            break
        case "doctor":
            tableItem.checkItem = "医生"
            break
        case "QX":
            tableItem.checkItem = "病人去向"
            break
        case "nurse":
        //     tableItem.checkItem = "护士"
        //     break
        // case "grade":
        //     tableItem.checkItem = "病情分级"
        //     break
        // case "BQZG":
        //     tableItem.checkItem = "病情转归"
        //     break
        // case "address":
        //     tableItem.checkItem = "车辆/医院名称"
        //     break
        // case "addressCode":
        //     tableItem.checkItem = "车辆/车辆/医院编码"
        //     break
    }
    // tableItem.checkItem = Object.keys(obj)[index]
    return tableItem
}

/**
 * 智能调度列表(病例基础信息)
 * @param {*} objJson 
 * @returns 
 */
export function patientBaseList(objJson) {
    // console.log(objJson)
    let patientInfoArr = []
    if (objJson.length > 0)
        objJson.forEach(ele => {
            let patientInfo = new PatientDataMD()
            patientInfo.Name = ele.Name
            patientInfo.Age = ele.Age
            patientInfo.AgeType = ele.AgeType
            patientInfo.AmbCode = ele.AmbCode
            patientInfo.AmbName = ele.AmbName
            patientInfo.AmbulanceDoctor = ele.AmbulanceDoctor
            patientInfo.AmbulanceDoctorWork = ele.AmbulanceDoctorWork
            patientInfo.BloodType = ele.BloodType
            patientInfo.CertificateCode = ele.CertificateCode
            patientInfo.CertificateType = ele.CertificateType
            patientInfo.Company = ele.Company
            patientInfo.Contacts = ele.Contacts
            patientInfo.DiseaseKeyword = ele.DiseaseKeyword
            patientInfo.HospitalCode = ele.HospitalCode
            patientInfo.HospitalDoctor = ele.HospitalDoctor
            patientInfo.HospitalDoctorWork = ele.HospitalDoctorWork
            patientInfo.HospitalName = ele.HospitalName
            patientInfo.IllnessLevel = ele.IllnessLevel
            patientInfo.IsGroup = ele.IsGroup
            patientInfo.IsReinforcement = ele.IsReinforcement
            patientInfo.IsVip = ele.IsVip
            patientInfo.Nationality = ele.Nationality
            patientInfo.PatientRecordCode = ele.PatientRecordCode
            patientInfo.PatientType = ele.PatientType
            patientInfo.Position = ele.Position
            patientInfo.SceneDoctor = ele.SceneDoctor
            patientInfo.SceneDoctorWork = ele.SceneDoctorWork
            patientInfo.SeeADoctorDate = ele.SeeADoctorDate
            patientInfo.Sex = ele.Sex
            patientInfo.State = ele.State
            // 1待转送；2转送中；3已转送；4处置完成
            // switch(ele.State){
            //     case 1:

            // }
            patientInfo.StateName = ele.StateName
            patientInfo.Symptom = ele.Symptom
            patientInfo.TaskCode = ele.TaskCode
            patientInfo.Telephone = ele.Telephone
            patientInfo.UpdateTime = ele.UpdateTime
            patientInfo.VenuesCode = ele.VenuesCode
            patientInfo.VenuesName = ele.VenuesName
            // patientInfo.ambLat = ele.ambLat
            // patientInfo.ambLng = ele.ambLng
            // patientInfo.hosLat = ele.hosLat
            // patientInfo.hosLng = ele.hosLng
            let baidugps1 = wgs84togcj02tobd09(ele.ambLng, ele.ambLat)
            patientInfo.ambLat = baidugps1.Lat
            patientInfo.ambLng = baidugps1.Lng
            // console.log("首页车辆",patientInfo.ambLat)
            let baidugps2 = wgs84togcj02tobd09(ele.hosLng, ele.hosLat)
            patientInfo.hosLat = baidugps2.Lat
            patientInfo.hosLng = baidugps2.Lng
            patientInfo.CityCode = ele.CityCode
            patientInfo.mpLng = ele.mpLng
            patientInfo.mpLat = ele.mpLat
            patientInfoArr.push(patientInfo)
        })
    // console.log(patientInfoArr)
    return patientInfoArr
}


export function scheduleListRetu(objJson) {
    // console.log(objJson)
    let scheduleListArr = []
    objJson.forEach(item => {
        let scheduleListitem = new scheduleListMD()
        scheduleListitem.code = item.it.Code
        scheduleListitem.endTime = item.it.EndTime
        scheduleListitem.isEffective = item.it.IsEffective
        scheduleListitem.matchName = item.it.MatchName
        scheduleListitem.startTime = item.it.StartTime
        scheduleListitem.venuesCode = item.it.VenuesCode
        scheduleListitem.isCurMatch = item.IsSchedule
        // color 和type 根据isCurMatch做判断取值
        switch (item.IsSchedule) {
            case "已结束":
                scheduleListitem.color = "#909399"
                scheduleListitem.type = "info"
                break;
            case "赛事中":
                scheduleListitem.color = "#f56c6c"
                scheduleListitem.type = "danger"
                break;
            case "未开始":
                scheduleListitem.color = "#409eff"
                scheduleListitem.type = "primary"
                break;
            default:
                break;
        }
        scheduleListArr.push(scheduleListitem)
    })
    // console.log(scheduleListArr)
    return scheduleListArr
}